package com.itheima.d19StringBuilder;

/**
 * 学会StringBuilder来操作字符串，了解性能好的原因
 */
public class Test {
    public static void main(String[] args) {
        int[] numbers = new int[]{1,2,3};
        String print = print(numbers);
        System.out.println(print);
    }

    public static String print(int[] numbers) {
        StringBuilder sb = new StringBuilder();
        sb.append("该数组内容为:[");
        for (int i = 0; i < numbers.length; i++) {
            if (i != numbers.length - 1) {
                sb.append(numbers[i]).append(",");
            } else {
                sb.append(numbers[i]);
            }
        }
        sb.append("]");
        return sb.toString();
    }
}
